<template>
  
  <div>
    <!-- 幻灯片 开始 -->
    <div v-swiper:mySwiper="swiperOption">
        <div class="swiper-wrapper">
            <div class="swiper-slide" style="background: #040B1B;">
                <a target="_blank" href="/">
                    <img src="https://pj.csxbank.com/static/img/pic_banner.49d5d44d.png" alt="首页banner">
                </a>
            </div>
            <div class="swiper-slide" style="background: #F3260B;">
                <a target="_blank" href="/">
                    <img src="https://pj.csxbank.com/static/img/ymt_step2.aa58bfba.jpg" alt="首页banner">
                </a>
            </div>
        </div>
        <div class="swiper-pagination swiper-pagination-white"></div>
        <div class="swiper-button-prev swiper-button-white" slot="button-prev"></div>
        <div class="swiper-button-next swiper-button-white" slot="button-next"></div>
    </div>
    <!-- 幻灯片 结束 -->
    
     <div id="aCoursesList">
      <div>
        <section class="container">
          <header class="comm-title">
            <h2 class="tac">
              <span class="c-333">热门产品</span>
            </h2>
          </header>
          <div>
            <article class="comm-course-list">
              <ul class="of" id="bna">
               <li v-for="itme in productList" :key="itme.id">
                <div class="cc-l-wrap">
                  <section class="course-img">
                    <img
                      :src="itme.img"
                      style="width: 100%; height: 150px"
                      class="img-responsive"
                    />
                    <div class="cc-mask">
                      <a
                        :href="'/product/' + itme.id"
                        title="查看详情"
                        class="comm-btn c-btn-1"
                        >查看详情</a
                      >
                    </div>
                  </section>
                  <h3 class="hLh30 txtOf mt10">
                    <a
                      :href="'/product/' + itme.id"
                      :title="itme.name"
                      class="course-title fsize18 c-333"
                      >{{ itme.name }}</a
                    >
                  </h3>
                  <section class="mt10 hLh20 of">
                    <span class="fr jgTag bg-green">
                      <i style="cursor: pointer" class="c-fff fsize12 f-fA"
                        >￥{{ itme.price }}</i
                      >
                    </span>
                    <span class="fl jgAttr c-ccc f-fA">
                      <i class="c-999 f-fA">{{ itme.sale }}人已购买</i>
                    </span>
                  </section>
                </div>
              </li>
              </ul>
              <div class="clear"></div>
            </article>
            <section class="tac pt20">
              <a href="/product" title="全部产品" class="comm-btn c-btn-2">全部产品</a>
            </section>
          </div>
        </section>
      </div>
    
    </div>
  </div>
</template>

<script>
import productApi from "@/api/product.js";
export default {
  asyncData({ params }) {
    return productApi.getAllProduct(1).then((response) => {
      console.log(response)
      return {
        productList: response.data.data.data,
      };
    });
  },
  data () {
    return {
      swiperOption: {
        //配置分页
        pagination: {
          el: '.swiper-pagination'//分页的dom节点
        },
        //配置导航
        navigation: {
          nextEl: '.swiper-button-next',//下一页dom节点
          prevEl: '.swiper-button-prev'//前一页dom节点
        }
      }
    }
  },
  methods:{

  },

}
</script>